<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Spring Boot JAR vs 普通 JAR：深度对比解析</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        
        .card-hover {
            transition: all 0.3s ease;
            border: 2px solid transparent;
        }
        
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
            border-color: #667eea;
        }
        
        .feature-icon {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        
        .section-title {
            position: relative;
            padding-bottom: 1rem;
        }
        
        .section-title::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 60px;
            height: 4px;
            background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
            border-radius: 2px;
        }
        
        .comparison-table {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
        }
        
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 2rem 0;
        }
        
        .highlight-box {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            color: white;
            padding: 1.5rem;
            border-radius: 1rem;
            margin: 2rem 0;
        }
        
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .animate-fade-in {
            animation: fadeInUp 0.8s ease-out;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20">
        <div class="container mx-auto px-6">
            <div class="text-center animate-fade-in">
                <h1 class="text-5xl md:text-6xl font-bold mb-6">
                    Spring Boot JAR <span class="text-yellow-300">vs</span> 普通 JAR
                </h1>
                <p class="text-xl md:text-2xl mb-8 opacity-90">
                    深入理解两种打包方式的本质区别
                </p>
                <div class="flex justify-center space-x-4">
                    <div class="bg-white bg-opacity-20 rounded-lg px-6 py-3">
                        <i class="fas fa-rocket mr-2"></i>
                        自包含可执行
                    </div>
                    <div class="bg-white bg-opacity-20 rounded-lg px-6 py-3">
                        <i class="fas fa-server mr-2"></i>
                        嵌入式容器
                    </div>
                    <div class="bg-white bg-opacity-20 rounded-lg px-6 py-3">
                        <i class="fas fa-cloud mr-2"></i>
                        云原生友好
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Introduction -->
    <section class="py-16 bg-white">
        <div class="container mx-auto px-6">
            <div class="max-w-4xl mx-auto">
                <p class="text-lg leading-relaxed text-gray-700 indent-8">
                    Spring Boot 打包的 jar 文件通过内置所有必需的依赖和嵌入式服务器，使得部署和运行更加方便，它特别适合现代的微服务架构和容器化部署。而普通 jar 文件则是传统的 Java 应用打包方式，通常依赖外部的应用服务器和手动配置。
                </p>
            </div>
        </div>
    </section>

    <!-- Visual Comparison Diagram -->
    <section class="py-16 bg-gray-50">
        <div class="container mx-auto px-6">
            <h2 class="text-3xl font-bold text-center mb-12 section-title">架构对比图</h2>
            <div class="mermaid">
                graph TB
                    subgraph "Spring Boot JAR"
                        A[可执行 JAR] --> B[BOOT-INF/classes]
                        A --> C[BOOT-INF/lib]
                        A --> D[嵌入式 Tomcat]
                        A --> E[Spring Boot Loader]
                        style A fill:#667eea,stroke:#fff,color:#fff
                        style D fill:#f093fb,stroke:#fff,color:#fff
                    end
                    
                    subgraph "普通 JAR"
                        F[标准 JAR] --> G[应用类文件]
                        F --> H[资源文件]
                        F --> I[MANIFEST.MF]
                        J[外部应用服务器]
                        K[外部依赖 JAR]
                        style F fill:#64748b,stroke:#fff,color:#fff
                        style J fill:#94a3b8,stroke:#333
                        style K fill:#94a3b8,stroke:#333
                    end
            </div>
        </div>
    </section>

    <!-- Main Comparison Content -->
    <section class="py-16 bg-white">
        <div class="container mx-auto px-6">
            <div class="grid md:grid-cols-2 gap-8 mb-16">
                <!-- Self-contained -->
                <div class="card-hover bg-gradient-to-br from-purple-50 to-pink-50 rounded-2xl p-8">
                    <div class="flex items-center mb-6">
                        <i class="fas fa-box text-4xl feature-icon mr-4"></i>
                        <h3 class="text-2xl font-bold">1. 自包含（Self-contained）</h3>
                    </div>
                    <div class="space-y-4">
                        <div class="bg-white rounded-lg p-4">
                            <h4 class="font-semibold text-purple-700 mb-2">Spring Boot JAR</h4>
                            <p class="text-gray-700">自包含的可执行 jar 文件，包含所有依赖项、资源文件和嵌入式 Web 容器。只需运行 <code class="bg-gray-100 px-2 py-1 rounded">java -jar your-app.jar</code> 即可启动。</p>
                        </div>
                        <div class="bg-white rounded-lg p-4">
                            <h4 class="font-semibold text-gray-700 mb-2">普通 JAR</h4>
                            <p class="text-gray-600">仅包含应用程序代码和资源，外部依赖需手动配置 classpath，通常无法直接运行。</p>
                        </div>
                    </div>
                </div>

                <!-- Embedded Container -->
                <div class="card-hover bg-gradient-to-br from-blue-50 to-cyan-50 rounded-2xl p-8">
                    <div class="flex items-center mb-6">
                        <i class="fas fa-server text-4xl feature-icon mr-4"></i>
                        <h3 class="text-2xl font-bold">2. 嵌入式 Web 容器</h3>
                    </div>
                    <div class="space-y-4">
                        <div class="bg-white rounded-lg p-4">
                            <h4 class="font-semibold text-blue-700 mb-2">Spring Boot JAR</h4>
                            <p class="text-gray-700">内置 Tomcat、Jetty 或 Undertow，无需单独安装配置服务器，应用启动时容器自动启动。</p>
                        </div>
                        <div class="bg-white rounded-lg p-4">
                            <h4 class="font-semibold text-gray-700 mb-2">普通 JAR</h4>
                            <p class="text-gray-600">不包含 Web 容器，需要部署到外部应用服务器如 Tomcat、JBoss 等。</p>
                        </div>
                    </div>
                </div>

                <!-- Boot Mechanism -->
                <div class="card-hover bg-gradient-to-br from-green-50 to-emerald-50 rounded-2xl p-8">
                    <div class="flex items-center mb-6">
                        <i class="fas fa-rocket text-4xl feature-icon mr-4"></i>
                        <h3 class="text-2xl font-bold">3. 启动类和加载机制</h3>
                    </div>
                    <div class="space-y-4">
                        <div class="bg-white rounded-lg p-4">
                            <h4 class="font-semibold text-green-700 mb-2">Spring Boot JAR</h4>
                            <p class="text-gray-700">包含特殊启动类，通过 spring-boot-loader 处理类加载，自动引导 Spring 上下文和嵌入式容器。</p>
                        </div>
                        <div class="bg-white rounded-lg p-4">
                            <h4 class="font-semibold text-gray-700 mb-2">普通 JAR</h4>
                            <p class="text-gray-600">启动类由开发者定义，不包含特殊类加载逻辑。</p>
                        </div>
                    </div>
                </div>

                <!-- File Structure -->
                <div class="card-hover bg-gradient-to-br from-yellow-50 to-orange-50 rounded-2xl p-8">
                    <div class="flex items-center mb-6">
                        <i class="fas fa-folder-tree text-4xl feature-icon mr-4"></i>
                        <h3 class="text-2xl font-bold">4. 文件结构</h3>
                    </div>
                    <div class="space-y-4">
                        <div class="bg-white rounded-lg p-4">
                            <h4 class="font-semibold text-yellow-700 mb-2">Spring Boot JAR</h4>
                            <ul class="text-gray-700 space-y-1">
                                <li><i class="fas fa-folder mr-2 text-yellow-600"></i><code>/BOOT-INF/classes/</code> - 应用类文件</li>
                                <li><i class="fas fa-folder mr-2 text-yellow-600"></i><code>/BOOT-INF/lib/</code> - 所有依赖</li>
                                <li><i class="fas fa-folder mr-2 text-yellow-600"></i><code>/META-INF/</code> - 元数据</li>
                                <li><i class="fas fa-file-code mr-2 text-yellow-600"></i><code>org.springframework.boot.loader.*</code></li>
                            </ul>
                        </div>
                        <div class="bg-white rounded-lg p-4">
                            <h4 class="font-semibold text-gray-700 mb-2">普通 JAR</h4>
                            <p class="text-gray-600">简单结构，仅包含类文件、资源和 /META-INF/ 目录。</p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Additional Features -->
            <div class="grid md:grid-cols-3 gap-6 mb-16">
                <div class="bg-gradient-to-br from-indigo-100 to-purple-100 rounded-xl p-6 text-center">
                    <i class="fas fa-package text-4xl text-indigo-600 mb-4"></i>
                    <h3 class="text-xl font-bold mb-3">5. 打包方式</h3>
                    <p class="text-gray-700">Spring Boot 使用专门插件自动处理依赖，普通 JAR 需要手动管理。</p>
                </div>
                
                <div class="bg-gradient-to-br from-pink-100 to-red-100 rounded-xl p-6 text-center">
                    <i class="fas fa-cloud-upload-alt text-4xl text-pink-600 mb-4"></i>
                    <h3 class="text-xl font-bold mb-3">6. 部署和运行</h3>
                    <p class="text-gray-700">Spring Boot 独立运行，适合微服务；普通 JAR 需要应用服务器。</p>
                </div>
                
                <div class="bg-gradient-to-br from-green-100 to-teal-100 rounded-xl p-6 text-center">
                    <i class="fas fa-magic text-4xl text-green-600 mb-4"></i>
                    <h3 class="text-xl font-bold mb-3">7. 便捷性</h3>
                    <p class="text-gray-700">Spring Boot 部署简单，CI/CD 友好；普通 JAR 配置复杂。</p>
                </div>
            </div>

            <!-- Summary Highlight -->
            <div class="highlight-box max-w-4xl mx-auto text-center">
                <h3 class="text-2xl font-bold mb-4">
                    <i class="fas